﻿using BCT.Domains;
using BCT.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace BCT.Api.Controllers
{
    public class RoleManageController : ApiController
    {
        private readonly IRoleManageDomain _roleManageDomain;

        public RoleManageController(RoleManageDomain roleManageDomain)
        {
            _roleManageDomain = roleManageDomain;
        }
        [HttpGet,HttpPost]
        public Response GetRoleList([FromBody]ConditionModel model)
        {
            var roleList = _roleManageDomain.GetRoleList(model);
            return new Response() { data = roleList.Data, count = roleList.Count};
        }
        [HttpGet, HttpPost]
        public Response GetRoleSelect()
        {
            var roleList = _roleManageDomain.GetRoleSelect();
            return new Response() { data = roleList};
        }
        [HttpGet, HttpPost]
        public Response AddRole(RoleModel model)
        {
            var addRole = _roleManageDomain.AddRole(model);
            return new Response() { data = addRole };
        }
        public Response ModefyRole(RoleModel model)
        {
            var modefyRole = _roleManageDomain.ModefyRole(model);
            return new Response() { data = modefyRole };
        }
        public Response LogDelete(RoleModel model)
        {
            var logDeleteRole = _roleManageDomain.LogDelete(model);
            return new Response() { data = logDeleteRole };
        }
    }
}
